package io.geekidea.springbootplus.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.geekidea.springbootplus.system.entity.SysAddress;
import io.geekidea.springbootplus.system.param.SysAddressPageParam;
import io.geekidea.springbootplus.system.param.sysmember.SysMemberPageParam;
import io.geekidea.springbootplus.system.vo.SysAddressQueryVo;
import io.geekidea.springbootplus.system.vo.SysMemberQueryVo;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface SysAddressMapper extends BaseMapper<SysAddress> {
    Integer addAddress (SysAddress sysAddress);


   /* Integer updateAddress (SysAddress sysAddress);*/

    /**
     * 根据条件分页显示收货地址信息列表
     *
     * @param page
     * @param sysAddressPageParam
     * @return
     */
    IPage<SysAddressQueryVo> getSysAddressPageList(@Param("page") Page page, @Param("param") SysAddressPageParam sysAddressPageParam);

    SysAddressQueryVo selectAddressById(Integer id);

    Integer deleteAddress(Integer id);

    Integer deleteAddressByBatch(List<Integer> idList);


    /**
     * 根据memberId显示收货地址信息列表
     * @param memberId
     * @return
     */
   List<SysAddressQueryVo> getSysAddressByMemberId(@Param("memberId") Integer memberId);

    /**
     * 根据memberId获取地址数量
     */
   Integer getAddressCount(Integer memberId);

   /*
   * 修改默认地址
   */
   Integer updateDefaultAddress (Integer id);

   /*根据会员编号获取默认地址*/
    SysAddress getDefaultAddress (Integer memberId);




}
